<?php
include_once("../UserDao.php");

//create user
$testUser = new user("Jeff", "Terry", 12344321, "jterry");
echo "created user. \n";
echo "  ".$testUser->getStudentId()."\n";
//create dao
$dao = new UserDao();
echo "created dao. \n";

//put into db
$result = $dao->insert($testUser);
echo "inserted. got return value: $result. \n";
echo "  mysql error: ".mysql_error()."\n";

//lookup 1
$look1 = $dao->lookupByUwId('12344321');
echo "lookup1: \n";
if($look1 == 0) die("lookup fail");
echo "  ".$look1->getLastName()."\n";

//lookup 2
$look2 = $dao->lookupByUserName('jterry');
echo "lookup2: \n";
echo "  ".$look2->getLastName()."\n";

//delete it from db
$result = $dao->remove($look1);
echo "deleted. got return value: $result. \n";
echo "  mysql error: ".mysql_error()."\n";

//check to make sure its deleted
//lookup 3
$look3 = $dao->lookupByUserName('jterry');
if($look3==0) "relookup returned empty -> verified that it is deleted."
?>
